<include file="Public/head"/>
<body class="no-skin">
<include file="Public/header"/>
<script type="text/javascript" src="__PUBLIC__/qwadmin/js/calendar/WdatePicker.js"></script>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed');
        } catch (e) {
        }
    </script>

    <include file="Public/sidebar"/>
    <div class="main-content">
        <div class="main-content-inner">
            <!-- #section:basics/content.breadcrumbs -->
            <include file="Public/breadcrumbs"/>

            <!-- /section:basics/content.breadcrumbs -->
            <div class="page-content">
                <include file="Public/set"/>

                <!-- /section:settings.box -->
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="row">

                            <form class="form-inline" action="" style=" padding: 0px 5px; float:left" method="get">

                                <label class="inline">订单搜索</label>
                                <label class="inline">订单编号</label>
                                <input type="text" name="ref" value="{$Think.get.ref}" class="form-control" size="15">
                                <label class="inline">购买人</label>
                                <input type="text" name="buyer_name" value="{$Think.get.buyer_name}" size="10" class="form-control">
                                <div class="form-group">
                                    <label class="inline">商家ID</label>
                                	<input type="text" name="distribution_customer_id" value="{$Think.get.distribution_customer_id}" size="10" class="form-control">
                                </div>
                                <label class="inline">订单时间</label>
                                <input type="text" name="start_time" value="{$Think.get.start_time}" class="form-control date-picker" readonly onClick="WdatePicker()" size="12"> - <input type="text" name="end_time" value="{$Think.get.end_time}" readonly class="form-control" onClick="WdatePicker()" size="12">
                                <button type="submit" class="btn btn-purple btn-sm">
                                    <span class="ace-icon fa fa-search icon-on-right bigger-110"></span>
                                    Search
                                </button>
                            </form>
                        </div>
						<style>
							.infobox{ width:auto;}
						</style>
                        <div class="space-4"></div>
                        <div class="row" style="">
							<div class="col-sm-12">
								<div class="infobox infobox-pink" style="width:25%;">
									<div class="infobox-icon">
										<i class="ace-icon fa fa-shopping-cart"></i>
									</div>

									<div class="infobox-data">
										<span class="infobox-data-number">{$order_total}</span>
										<div class="infobox-content">订单总数</div>
									</div>
								</div>
								<div class="infobox infobox-pink" style="width:25%;">
									<div class="infobox-icon">
										<i class="ace-icon fa fa-shopping-cart"></i>
									</div>

									<div class="infobox-data">
										<span class="infobox-data-number">{:number_format($order_total_price , 2)}</span>
										<div class="infobox-content">订单总金额</div>
									</div>
								</div>
								<div class="infobox infobox-pink" style="width:25%;">
									<div class="infobox-icon">
										<i class="ace-icon fa fa-shopping-cart"></i>
									</div>
									<div class="infobox-data">
										<span class="infobox-data-number"><a href="{:U('Qwadmin/order/index',array('type' => 'not_pay'))}">{$order_no_pay_total}</a></span>
										<div class="infobox-content">未付款订单</div>
									</div>
								</div>
								<div class="infobox infobox-pink" style="width:24%;">
									<div class="infobox-icon">
										<i class="ace-icon fa fa-shopping-cart"></i>
									</div>
									<div class="infobox-data">
										<span class="infobox-data-number">{:number_format($order_not_pay_price,2)}</span>
										<div class="infobox-content">未付款总金额</div>
									</div>
								</div>
							</div>
						</div>
						<div class="space-4"></div>
                        <style>
                            .goodslist{font-size: 10px;}
                        </style>
                        <div class="row">
                            <form id="form" method="post" action="{:U('goodsBath')}">
                                <table class="table table-striped table-bordered table-hover goodslist" >
                                    <thead>
                                    <tr>
                                        <th class="center"><input class="check-all" type="checkbox" value=""></th>
                                        <th width="100px">订单编号</th>
                                        <th>分销商</th>
                                        <th>订购人</th>
                                        <th>联系方式</th>
                                        <th>运费</th>
                                        <th>订单总额</th>
                                        <th>支付状态</th>
                                        <th>发货状态</th>
                                        <th>订单日期</th>
                                        <th>创建时间</th>
                                        <th class="center" width="50px" >操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>
                                    <style>
                                        .grouptd {
                                            position: relative;
                                        }

                                        .group {
                                            display: inline-block;
                                            width: 100%;
                                        }

                                        .groupselect {
                                            position: absolute;
                                            top: 0;
                                            left: 0;
                                            width: 100%;
                                            height: 100%;
                                            border: 0;
                                        }
                                    </style>
                                    <volist name="list" id="val">
                                        <tr>
                                            <td class="center">
                                               <input class="ids" type="checkbox" name="ids[]" value="{$val['id']}">
                                            </td>
                                            <td><a href="{:U('detail',array('ref'=>$val['ref']))}" target="_new">{$val['ref']}</a></td>
                                            <td><a href="{:U('Order/index',array('distribution_customer_id' => $val['distribution_customer_id']))}">{$val['distribution_name']}</a></td>
                                            <?php $receive_info = explode('|' , $val['receive_info']); ?>
                                            <td>{$receive_info[0]}</td>
                                            <td>{$receive_info[2]}</td>
                                            <td>{$val['delivery_fee']}</td>
                                            <td>{$val['amount_total']}</td>
                                            <td>
                                            	<switch name="val.pay_status">
                                                	<case value="0">未支付</case>
                                                    <case value="1">已支付一部分</case>
                                                    <case value="2">全部支付</case>
                                                </switch>
                                            </td>
                                            <td>
                                            	<switch name="val.express_send_status">
                                                	<case value="0">未发货</case>
                                                    <case value="1">发货一部分</case>
                                                    <case value="2">全部发货</case>
                                                </switch>
                                            </td>
                                            <td>{$val['date_order']}</td>
                                            <td>{$val['create_time']}</td>
                                            <td class="center"><a href="{:U('Order/detail',array('id'=>$val['id']))}">详情</a></td>
                                        </tr>
                                    </volist>
                                    
                                    </tbody>
                                </table>
                            
                            {$page}
                        </div>
                        <!-- PAGE CONTENT ENDS -->
                    </div><!-- /.col -->
                </div><!-- /.row -->
            </div><!-- /.page-content -->
        </div>
    </div><!-- /.main-content -->
    <include file="Public/footer"/>

</div><!-- /.main-container -->

<include file="Public/footerjs"/>
<!-- inline scripts related to this page -->
<script type="text/javascript">
    $(function () {
        var goods_type_id = $('#goods_type').val();
        if(goods_type_id){
            $('#goods_type_id option').each(function(){
                  if( goods_type_id == $(this).attr('value') ) {
                      $(this).attr('selected' , true);
                      return false;
                  } 
               }); 
        }
         
      


        $(".check-all").click(function () {
            $(".ids").prop("checked", this.checked);
        });
        $(".ids").click(function () {
            var option = $(".ids");
            option.each(function (i) {
                if (!this.checked) {
                    $(".check-all").prop("checked", false);
                    return false;
                } else {
                    $(".check-all").prop("checked", true);
                }
            });
        });
        $("input[id^='submit']").click(function () {
            var optype=$(this).attr("optype");
            $('input[name="optype"]').val(optype);
            if($(".ids:checked").size()<1){
                bootbox.alert({
                    title:"请选择商品",
                    message:"商品未选中，请选择商品！"
                });
                return false;
            }
            if($('input[name="siteids[]"]:checked').size()<1){
                bootbox.alert({
                    title:"请选择站点",
                    message:"站点未选择，请选择站点（至少一个）！"
                });
                return false;
            }
//            if($('#storeids-select').val()==0){
//                bootbox.alert({
//                    title:"请选择商铺",
//                    message:"商铺未选择，请选择商铺！"
//                });
//                return false;
//            }
            bootbox.confirm({
                title: "系统提示",
                message: "确定要批量操作本页的数据吗？"+optype,
                callback: function (result) {
                    if (result) {
                        $("#form").submit();
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
        
        $(".del").click(function () {
            var url = $(this).attr('val');
            bootbox.confirm({
                title: "系统提示",
                message: "是否要删除该商品?",
                callback: function (result) {
                    if (result) {
                        window.location.href = url;
                    }
                },
                buttons: {
                    "cancel": {"label": "取消"},
                    "confirm": {
                        "label": "确定",
                        "className": "btn-danger"
                    }
                }
            });
        });
    })
</script>
</body>
</html>
